﻿<% @title = "#{t :danhmucsach}" %>
<h6><%= t :danhmuccacloaisach %></h6>

<table class="table table-striped">
  <tr>
    
    <th><p><%= t :tentheloai%></p></th>
    <th></th>
    <th></th>
    <th><p><%= t :mota%></p></th>
    <th></th>
    <th></th>
    <th></th>
  </tr>

<% @categories.each do |category| %>
  <tr>
    <td><%= category.Description %></td>
    <th></th>
    <th></th>
    <td><%= category.Name%></td>
    <th></th>
    <th></th>

    <% if((session[:user_id])!=nil) %>
      <% @user = User.find(session[:user_id]) %>
        <%if(@user.GroupUserId==10) %>
            <td><%= link_to "#{t :show}", category %></td>
            <td><%= link_to "#{t :edit}", edit_category_path(category) %></td>
            <td><%= link_to "#{t :destroy}", category, confirm: "#{t :xoakhong}", method: :delete %></td> 
        <%else%>
            <td><%= link_to "#{t :show}", category %></td>
        <% end %>   
    <%end%>
            
    <% if((session[:user_id])==nil) %>
        <td><%= link_to "#{t :show}", category %></td>
    <% end %> 
    
  </tr>
<% end %>
</table>

<h6>
  <%= will_paginate @users, :previous_label => t("previous"), :next_label => t("next") %>
</h6>
<h6><%= link_to "#{t :themloaisachmoi}", new_category_path %></h6>